<?php

namespace app\index\model;

use think\Model;

class Router extends Model
{
    protected $autoWriteTimestamp='datetime';
    protected $updateTime = false;
    public static function init(){
        self::event('before_insert',function($routers){

            $isHas = Router::where(['id'=>$routers->id])->count();
            if($isHas)
            {
                Router::where(['id'=>$routers->id])->update($routers->toArray());
                return false;
            }
            return true;
        });
    }
}
